<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>directive</title>
  <script src="/vue.js"></script>
</head>
<body>
  <div id="root">
    <div v-font:green.bold="'100px'">
      这是一段文字
    </div>
  </div>
  <script>
    Vue.directive('font', (el, binding) => {
      let {arg, value, modifiers} = binding
      el.style.color = arg
      el.style.fontSize = value
      el.style.fontWeight = Object.keys(modifiers)[0]
    })

    var vm = new Vue({
      el: '#root',
      
    })
  </script>
</body>
</html>